package cn.edu.cuit.aumalls.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.edu.cuit.aumalls.entity.SubmitOrders;
import cn.edu.cuit.aumalls.service.PayService;

@Controller
public class Index {

	@Autowired
	PayService payService;
	
	//支付首页
	@RequestMapping("/showPay")
	public String showPay(Model model) {
		SubmitOrders submitOrders = payService.showPay();
		double orderPrice = submitOrders.getOrder_price();
		String.format("%.2f", orderPrice);
		
		model.addAttribute("submitOrders", submitOrders);
		model.addAttribute("orderPrice",orderPrice);
		return "index";
	}
	//付款界面
	@RequestMapping("/tradepagepay")
	public String TradePagePay() {
		
		return "alipay.trade.page.pay";
	}
	//退款界面
	@RequestMapping("/traderefund")
	public String TradeRefund() {
		
		return "alipay.trade.refund";
	}
	//退款查询界面
	@RequestMapping("/traderefundquery")
	public String TradeRefundQuery() {
		
		return "alipay.trade.fastpay.refund.query";
	}
	//交易查询界面
	@RequestMapping("/tradequery")
	public String TradeQuery() {
		
		return "alipay.trade.query";
	}
	//交易关闭界面
	@RequestMapping("/tradeclose")
	public String TradeClose() {
		
		return "alipay.trade.close";
	}
	//tongbu fan hui 
	@RequestMapping("/return_url")
	public String Return() {
		
		return "select_pay";
	}
	
	@RequestMapping("/notify_url")
	public String ReturnNot() {
		
		return "notify_url";
	}
}
